package com.yizhu.zczy.project.controller;

import java.util.Arrays;
import java.util.Map;


import com.yizhu.zczy.common.utils.PageUtils;
import com.yizhu.zczy.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yizhu.zczy.project.entity.ItemreturnsEntity;
import com.yizhu.zczy.project.service.ItemreturnsService;




/**
 * 项目回报表（暂时不用）
 *
 * @author guoyz
 * @email guoyz@mail.com
 * @date 2021-06-24 17:33:48
 */
@RestController
@RequestMapping("project/itemreturns")
public class ItemreturnsController {
    @Autowired
    private ItemreturnsService itemreturnsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("project:itemreturns:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = itemreturnsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{returnsId}")
    //@RequiresPermissions("project:itemreturns:info")
    public R info(@PathVariable("returnsId") Integer returnsId){
		ItemreturnsEntity itemreturns = itemreturnsService.getById(returnsId);

        return R.ok().put("itemreturns", itemreturns);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("project:itemreturns:save")
    public R save(@RequestBody ItemreturnsEntity itemreturns){
		itemreturnsService.save(itemreturns);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("project:itemreturns:update")
    public R update(@RequestBody ItemreturnsEntity itemreturns){
		itemreturnsService.updateById(itemreturns);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("project:itemreturns:delete")
    public R delete(@RequestBody Integer[] returnsIds){
		itemreturnsService.removeByIds(Arrays.asList(returnsIds));

        return R.ok();
    }

}
